package com.ddogring.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @BelongsProject: eshop
 * @BelongsPackage: com.ddogring.alipay.config
 * @Author: DdogRing
 * @CreateTime: 2023-02-01  11:49
 * @Description: TODO
 * @Version: 1.0
 */
public class AliPayConfig {

    //↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    // public static String app_id = "2021000122611352";
    public static String app_id = "2021003173657865";

    // 商户私钥，您的PKCS8格式RSA2私钥
    // public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCB75XCOeIihg1q+JHqdIbjDUK/JdmsJd2mxMRKvNMn5KIKfwLZ8LKqOQgyyQK3std8Ems8L+Q+X20u5PT1C3AQTaOM5xSOylhs+1rKWTNf9C+XNnKrBHHwU2WJryMpa+QrI0LZg9SRijsvHAXxv9b3wgLkE+F+SjdxyEFpYAK4r66LIgCS4QTK1xSKY2Ugz05sDsi6JGjUPCZJ1eXcTlX5UdZGHLduHPkuTrCaFeLQdEdK71cXsxetpXgRtPAzfEhLYme4VzOBuqPwrzRQyKQH6Vvd0X7UXDe69ddHbkC67wnGVTOZnchsAJQ3FSmOxhLhnx0V1wheVUA6mqH2+PmfAgMBAAECggEAWyxkJy86kAMEM0VMDfnKFFPfvASxImxHhZeYLOEmQV3angbVV1vf4jW2nPwTHhctwO+js03fmCyZjkg14iQudCImWt5ivHcbaQ1OfaHtvKy5IB+igoHR+VJrcxsjTxNXvTU22S354E3gjYPaX/G+w4atRKD2nwkwsnRUAb7O6gvGj1G2ADQVN16lG6aRPJOU6iTq19mYy7uTRCGbIs5UbndcriFYgtX9jzi6vhQHdG7Ut7gtYlTPEG65m38zhDUNwc5w+WnZP68LB7V96p0Attoouzt9Do6wNXJ4kFcXz3tFPR4cIR3vLhj2xqCd4HmllhrYygCCuIXAq+iioZq/0QKB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Sny7VpyHORAoGAdsxD/px7Kr8BkO2DYvSThjUf9hrqp/T2Ni3JCMDuB9cxsuLriPyDsq9ce0xpNabUdBfDebcXbD5NZdNa/Zr4mfdXm9Fk051uSqngOBu/sd/fkqAis8FQP+sk2Sey+xMXw8wjtemuBDH3xFq807qFePNu09tYqPZI89ZNrBFPUQECgYBnI29TK4dQNmLsyjoYOPwi+SYDylCnEvCzQPHs3M6q+pizyp8y/Zl21QlchDhjFoQn8Y2RwX8zQsyw/EopBsp0+VR7EqJuiifawEagsGvTTlodH/acKW5XobDzV0TqJ+6UxUmPjZd+94/07Cu4Zhg1e3BZi547KceuqEGiG+oK7Q==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    // public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkMfojMhOU030j7x0vqqTaJKg7NCgFBgRqDTaSme6oMWiRT6cZoJFhSyy1QhlUDC8pRHQjsrXl3jMO0b+5Gwx0mXwCnTc8jZ9kUBFQjAtdFU4PKbUb8Nz/fm6ev0LO1mLvVpkN285jAsqsW+zbkNmyJKjo9CW6BcmgeKOLYROygqTRenFIJs/JsuQ4A/yEMitmfwtR5oQfJg7U+X4RGWoqzrpJOAmKpBc2VNXBWImARJ6EXZqoTsDFFEZSJY/xeKfYJIvc8X4HwcWz348phKgPfEaO01EccU7sMJV05q62IMkhO3uevJp1ZDc/BlD1PCcmV7s9cDUOMOkgtCOPVyoiQIDAQAB";
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAirneJpuJ2ca22vwNphNUTn2eDoRmtzVsJQo5qR65DLMuZ6tJRH0NNXDaDgSnl9ViEVRZNnCUvSPxs2bvVsqic4HMZu1KlKXQGDCszL2rwqm4F4vzGw0LkqcDtad3ZdT9g55ncC+i5xb1HyNsIpPLyH+NdjpwL0BNnrIoSztsaRdtFWJCX4x/a49/Xp1DTK9OFVXtylafZtiEWbRlieBpWnB19GAFVjG/Bi6GITyuWjeUSwF9YfL73LBazC4wqoKazW8v8Egpbc9NCeSI8wQs7zAJdwrfwBSPHrzQpc7SPXMN33tawdYolGZ0isAB+QN4NTf0+9lmElYzyo1kdcjBuwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "https://www.ddogring.com/eshop/loan/back";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "https://www.ddogring.com/yijie";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    // public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";

    // 支付宝网关
    public static String log_path = "/Users/ddogring/logs";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
